package com.teamit.service;

import java.util.List;

import com.teamit.dao.DocumentDao;
import com.teamit.entity.Document;
import com.teamit.util.StringUtil;
import com.teamit.util.db.Page;

public class DocumentService {

	DocumentDao dd = new DocumentDao();
	Document document = new Document();
	/*public List<Document> findDocument(String projectid){
		return dd.findAllByProjectId(projectid);
	}*/
	public void saveDocument(String title,String content,String employeeid,String projectid){
	
		document.setId(StringUtil.getId());
		document.setTitle(title);
		document.setContent(content);
		document.setEmployeeid(employeeid);
		document.setProjectid(projectid);
		dd.save(document);
	}
	public Document findDocumentById(String id){
		return dd.findById(id);
	}
	public void edit(String id, String title, String content) {
		Document document = dd.findById(id);
		document.setTitle(title);
		document.setContent(content);
		dd.update(document);
	}
	public void del(String id) {
		dd.delete(id);
	}
	public Page<Document> findByPageAndProjectId(int pageNum,String id){
		return dd.findByPageAndProjectId(pageNum,id);
		
	}
}
